const initialState = {
  channels: [],
  list: [],
  total: 0,
  article: {}, // 文章详情
};

const article = (state = initialState, action) => {
  switch (action.type) {
    case 'article/getChannels':
      return {
        ...state,
        channels: action.payload,
      };
    case 'article/getArticles':
      return {
        ...state,
        ...action.payload,
      };
    case 'article/getArticleById':
      return {
        ...state,
        article: action.payload,
      };
    default:
      return state;
  }
};

export default article;
